/**
* @Author:lu
* @Date: 2019/12/22
* @Version: 1.0
* @Last Modified by: lu
* @Last Modified time: 2019/12/22
**/
<comment>
  # 积分商城
</comment>
<template>
  <div id="IntegrationShop" class="p-box">
    <div class="p-return">
      <mu-appbar color="primary" class="lan-header" style="box-shadow:none">
        <mu-button icon slot="left" v-close>
          <i class="iconfont angle-left iconangle-left"></i>
          <span class="lan-header-back">返回</span>
        </mu-button>积分商城
      </mu-appbar>
    </div>
    <div class="p-content">
      <div class="top">
        <div class="shop-box">
          <dl>
            <dd class="top">可兑换积分</dd>
            <dt class="center">{{leftScore}}</dt>
            <dd class="bottom">积分兑换不影响总积分排行</dd>
          </dl>
        </div>
        <div class="li-box">
          <div class="li" @click="goCode">
            <p class="li-left">
              <i class="iconfont iconerweima"></i>
              <span>兑换码</span>
            </p>
            <p class="li-right">
              <i class="iconfont iconangle-right"></i>
            </p>
          </div>
          <div class="li" @click="goDetail">
            <p class="li-left">
              <i class="iconfont iconjifenmingxi"></i>
              <span>兑换明细</span>
            </p>
            <p class="li-right">
              <i class="iconfont iconangle-right"></i>
            </p>
          </div>
          <div class="li" @click="goAddress">
            <p class="li-left">
              <i class="iconfont icondianpu"></i>
              <span>兑换店铺地址</span>
            </p>
            <p class="li-right">
              <i class="iconfont iconangle-right"></i>
            </p>
          </div>
        </div>
      </div>
      <!-- <div class="address-box" v-if="false">
        <div class="address-title">兑换店铺地址：</div>
        <div class="address-content">
          <ul>
            <li v-for="(item,index) in data" :key="index">
              <p>{{item.shopName}}</p>
              <p>{{item.shopAddress}}</p>
            </li>
          </ul>
        </div>
      </div>-->
    </div>
  </div>
</template>

<script>
export default {
  name: "IntegrationShop",
  components: {},
  props: {},
  data() {
    return {
      leftScore: 0,
      data: [],
      mxImg: require("#/assets/img/mx.png")
    };
  },
  computed: {},
  created() {
    this.initTotal();
    // this.initAddress();
  },
  mounted() {},
  watch: {},
  methods: {
    initTotal() {
      this.$openLoading();
      this.$A
        .Go("get", "/safety/userScore/myScore", {
          userId: this.$A.GS("userInfo")["userId"]
        })
        .then(res => {
          this.$closeLoading();
          if (res.code == 200) {
            if (res.body) {
              this.leftScore = res.body.leftScore;
            }
            // this.form.pointList = array;
          } else {
          }
        });
    },
    // initAddress() {
    //   this.$openLoading();
    //   let params = {
    //     orgId: this.$A.GS("orgInfo")["orgId"],
    //     type: this.$A.GS("orgInfo")["type"],
    //     current: -1,
    //     size: 10
    //   };
    //   this.$A.Go("get", "/safety/shop/pageList", params).then(res => {
    //     this.$closeLoading();
    //     if (res.code == 200 && res.body.rows && res.body.rows.length) {
    //       res.body.rows.forEach(item => {
    //         if (item.status == 0) {
    //           this.data.push(item);
    //         }
    //       });
    //     } else {
    //       this.data = [];
    //     }
    //   });
    // },
    goDetail() {
      this.$router.push({
        name: "IntegrationExchangeMessage"
      });
    },
    goCode() {
      if (this.leftScore > 0) {
        this.$router.push({
          name: "IntegrationCode"
        });
      } else {
        this.$A.MS("暂无可兑换积分");
      }
    },
    goAddress() {
      this.$router.push({
        name: "IntegrationShopAddress"
      });
    }
  },
  destroyed() {}
};
</script>

<style lang="scss">
#IntegrationShop {
  .p-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    .address-box {
      flex: 1;
      overflow: auto;
    }
  }
  .li-box {
    .li {
      height: 0.55rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.14rem;
      box-shadow: 0rem 0.01rem 0rem 0rem rgba(224, 224, 224, 1);
    }
    .li-left {
      height: 100%;
      display: flex;
      align-items: center;
      .iconfont {
        color: #0080cb;
        font-size: 0.23rem;
        margin-right: 0.15rem;
      }
    }
    .li-right {
      color: #dbdbdb;
    }
  }
  .address-box {
    padding: 0.16rem 0.14rem;
    .address-title {
      font-size: 0.15rem;
      font-weight: bold;
    }
    .address-content {
      li {
        margin-top: 0.14rem;
        font-size: 0.13rem;
        color: #8c8c8c;
      }
    }
  }
}
</style>
